//
// Created by fanghr on 17-12-29.
//

#ifndef PROJECT_SERIAL_H
#define PROJECT_SERIAL_H

#include "../include.h"

class Serial {
private:
    std::string device;
    boost::asio::serial_port serial_port;
    void read_buf();
public:
    Serial(boost::asio::io_service&,std::string);
    ~Serial();
    void set_baud_rate(int);
    void run();
    void stop();
    typedef void (*callback_t)(char*,size_t);
    void set_callback(callback_t);

private:

    callback_t callback;
};


#endif //PROJECT_SERIAL_H

